<% serie = nil %>
<%= hidden_field_tag :serie, SERIES.values_at(SERIES.index(params[:serie])+1) if params[:serie]%>
<table>  
  <% @matches.each do |match| %>
  <% bet = Bet.for_match_and_user(match, @user) %>
  <% unless serie == match.serie %>
    <% serie = match.serie%>	
    <tr><td><%= "Grupo #{serie}" %></td></tr>
  <% end %>
  <tr>
	<td>
		<%= match.start.strftime("%d/%m/%y") %>
	</td>
	<td>
		<%= match.start.strftime("%H:%M") %>
	</td>
	<td>&nbsp;
	</td>
	<td>
		<%= team_avatar match.team_local %>
	</td>
	<td>
		<%= text_field_tag "bet[#{match.id}][local_goals]", bet ? bet.local_goals : 0, :size => 2 %>
	</td>
	<td>
		<%= text_field_tag "bet[#{match.id}][visitor_goals]", bet ? bet.visitor_goals : 0, :size => 2 %> 
	</td>
	<td>
		<%= team_avatar match.team_visitor %>
	</td>
	<td>
		<%= stadistics match %>
	</td>
  </tr>
  <% end %>
</table>